---
title: Look up / test membership in a hazard group collection
summary: Finds, tests containment of, or removes hazard groups from an already-retrieved collection.
status: draft
owner: SAIF Documentation Generator
last_reviewed: 2026-08-21
library: SAIF.Business.Policy
reference_type: package
operation_id: op-03-hazard-group-lookup
trigger: Caller query on a retrieved collection
---

# Look up test membership in a hazard group collection

Provides lookup, containment-test, and removal operations over an already-retrieved `clsHazardGroupCollection`.

| Field | Value |
| --- | --- |
| **Operation ID** | op-03-hazard-group-lookup |
| **Trigger** | Caller query on a retrieved collection |
| **Inputs** | `HazardGroupID` or `clsHazardGroup` instance |
| **Outputs** | Matching item, boolean result, or removal |
| **Primary components** | `ItemByKey`, `Contains`, `ContainsDeleted`, `Remove` |
| **Entry point** | SAIF.Business.Policy/clsHazardGroupCollection.vb |

## Steps

1. Linear scan of `List` (or `m_deletedList` for the deleted variants), comparing `HazardGroupID` ([BR-POL-003](../business-rules.md#br-pol-003-hazard-group-identity)).
2. First match is returned or removed depending on the calling method.

## Process flow

The following diagram visualizes this operation's control flow.

```mermaid
flowchart TD
	Start(["Caller query on a<br>retrieved collection"]) --> A["Linear scan of List (or<br>m_deletedList), comparing<br>HazardGroupID"]
	A --> End(["First match returned or<br>removed depending on<br>calling method"])
```

## Failure and edge-case behavior
- `ItemByKey` returns the last enumerated item (or `Nothing` on an empty list) when no match is found — a fall-through defect.*

> **Note:** Statements marked with * were inferred from code structure, naming conventions, or
> contextual evidence where direct confirmation was not available in source artifacts. Statements
> marked with ** could not be confirmed; treat as unknown until verified.

## Related documentation
- [Operations and processes](../operations-processes.md)
- [Business rules](../business-rules.md)
- [SQL catalog](../sql/index.md)
- [Database tables](../database-tables.md)

## Sources
- `SAIF.Business.Policy/clsHazardGroupCollection.vb`
